package day0115;

public class Test1 {
    public static void main(String[] args) {
        int[] arr={1,  3,  5 ,8, 10};
        find(arr, 10);
    }

    private static void find(int[] arr, int ele) {
        int start=0,   end=arr.length-1;
        while(start<=end){
            if(ele<arr[start] || ele>arr[end]){
                System.out.println("没找到");
                return;
            }

            int middle=(start+end)/2; //1
            if(arr[middle]==ele){
                System.out.println("找到了" +arr[middle]);
            }

            if(arr[middle]<ele){
                start=middle+1;
            }else{
                end=middle-1;
            }
        }
        System.out.println("没找到");
    }
}
